Left Termination of the query pattern inorder_in_2(g, a) w.r.t. the given Prolog program could successfully be proven:



Prolog
  ↳ PrologToPiTRSProof

Clauses:

inorder(nil, []).
inorder(tree(L, V, R), I) :- ','(inorder(L, LI), ','(inorder(R, RI), append(LI, .(V, RI), I))).
append([], X, X).
append(.(X, Xs), Ys, .(X, Zs)) :- append(Xs, Ys, Zs).

Queries:

inorder(g,a).

We use the technique of [30].Transforming Prolog into the following Term Rewriting System:
Pi-finite rewrite system:
The TRS R consists of the following rules:

inorder_in(tree(L, V, R), I) → U1(L, V, R, I, inorder_in(L, LI))
inorder_in(nil, []) → inorder_out(nil, [])
U1(L, V, R, I, inorder_out(L, LI)) → U2(L, V, R, I, LI, inorder_in(R, RI))
U2(L, V, R, I, LI, inorder_out(R, RI)) → U3(L, V, R, I, append_in(LI, .(V, RI), I))
append_in(.(X, Xs), Ys, .(X, Zs)) → U4(X, Xs, Ys, Zs, append_in(Xs, Ys, Zs))
append_in([], X, X) → append_out([], X, X)
U4(X, Xs, Ys, Zs, append_out(Xs, Ys, Zs)) → append_out(.(X, Xs), Ys, .(X, Zs))
U3(L, V, R, I, append_out(LI, .(V, RI), I)) → inorder_out(tree(L, V, R), I)

The argument filtering Pi contains the following mapping:
inorder_in(x1, x2)  =  inorder_in(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U1(x1, x2, x3, x4, x5)  =  U1(x2, x3, x5)
nil  =  nil
[]  =  []
inorder_out(x1, x2)  =  inorder_out(x2)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x2, x5, x6)
U3(x1, x2, x3, x4, x5)  =  U3(x5)
append_in(x1, x2, x3)  =  append_in(x1, x2)
.(x1, x2)  =  .(x1, x2)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x5)
append_out(x1, x2, x3)  =  append_out(x3)

Infinitary Constructor Rewriting Termination of PiTRS implies Termination of Prolog



↳ Prolog
  ↳ PrologToPiTRSProof
PiTRS
      ↳ DependencyPairsProof

Pi-finite rewrite system:
The TRS R consists of the following rules:

inorder_in(tree(L, V, R), I) → U1(L, V, R, I, inorder_in(L, LI))
inorder_in(nil, []) → inorder_out(nil, [])
U1(L, V, R, I, inorder_out(L, LI)) → U2(L, V, R, I, LI, inorder_in(R, RI))
U2(L, V, R, I, LI, inorder_out(R, RI)) → U3(L, V, R, I, append_in(LI, .(V, RI), I))
append_in(.(X, Xs), Ys, .(X, Zs)) → U4(X, Xs, Ys, Zs, append_in(Xs, Ys, Zs))
append_in([], X, X) → append_out([], X, X)
U4(X, Xs, Ys, Zs, append_out(Xs, Ys, Zs)) → append_out(.(X, Xs), Ys, .(X, Zs))
U3(L, V, R, I, append_out(LI, .(V, RI), I)) → inorder_out(tree(L, V, R), I)

The argument filtering Pi contains the following mapping:
inorder_in(x1, x2)  =  inorder_in(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U1(x1, x2, x3, x4, x5)  =  U1(x2, x3, x5)
nil  =  nil
[]  =  []
inorder_out(x1, x2)  =  inorder_out(x2)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x2, x5, x6)
U3(x1, x2, x3, x4, x5)  =  U3(x5)
append_in(x1, x2, x3)  =  append_in(x1, x2)
.(x1, x2)  =  .(x1, x2)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x5)
append_out(x1, x2, x3)  =  append_out(x3)


Using Dependency Pairs [1,30] we result in the following initial DP problem:
Pi DP problem:
The TRS P consists of the following rules:

INORDER_IN(tree(L, V, R), I) → U11(L, V, R, I, inorder_in(L, LI))
INORDER_IN(tree(L, V, R), I) → INORDER_IN(L, LI)
U11(L, V, R, I, inorder_out(L, LI)) → U21(L, V, R, I, LI, inorder_in(R, RI))
U11(L, V, R, I, inorder_out(L, LI)) → INORDER_IN(R, RI)
U21(L, V, R, I, LI, inorder_out(R, RI)) → U31(L, V, R, I, append_in(LI, .(V, RI), I))
U21(L, V, R, I, LI, inorder_out(R, RI)) → APPEND_IN(LI, .(V, RI), I)
APPEND_IN(.(X, Xs), Ys, .(X, Zs)) → U41(X, Xs, Ys, Zs, append_in(Xs, Ys, Zs))
APPEND_IN(.(X, Xs), Ys, .(X, Zs)) → APPEND_IN(Xs, Ys, Zs)

The TRS R consists of the following rules:

inorder_in(tree(L, V, R), I) → U1(L, V, R, I, inorder_in(L, LI))
inorder_in(nil, []) → inorder_out(nil, [])
U1(L, V, R, I, inorder_out(L, LI)) → U2(L, V, R, I, LI, inorder_in(R, RI))
U2(L, V, R, I, LI, inorder_out(R, RI)) → U3(L, V, R, I, append_in(LI, .(V, RI), I))
append_in(.(X, Xs), Ys, .(X, Zs)) → U4(X, Xs, Ys, Zs, append_in(Xs, Ys, Zs))
append_in([], X, X) → append_out([], X, X)
U4(X, Xs, Ys, Zs, append_out(Xs, Ys, Zs)) → append_out(.(X, Xs), Ys, .(X, Zs))
U3(L, V, R, I, append_out(LI, .(V, RI), I)) → inorder_out(tree(L, V, R), I)

The argument filtering Pi contains the following mapping:
inorder_in(x1, x2)  =  inorder_in(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U1(x1, x2, x3, x4, x5)  =  U1(x2, x3, x5)
nil  =  nil
[]  =  []
inorder_out(x1, x2)  =  inorder_out(x2)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x2, x5, x6)
U3(x1, x2, x3, x4, x5)  =  U3(x5)
append_in(x1, x2, x3)  =  append_in(x1, x2)
.(x1, x2)  =  .(x1, x2)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x5)
append_out(x1, x2, x3)  =  append_out(x3)
U41(x1, x2, x3, x4, x5)  =  U41(x1, x5)
APPEND_IN(x1, x2, x3)  =  APPEND_IN(x1, x2)
U31(x1, x2, x3, x4, x5)  =  U31(x5)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x2, x5, x6)
U11(x1, x2, x3, x4, x5)  =  U11(x2, x3, x5)
INORDER_IN(x1, x2)  =  INORDER_IN(x1)

We have to consider all (P,R,Pi)-chains

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
PiDP
          ↳ DependencyGraphProof

Pi DP problem:
The TRS P consists of the following rules:

INORDER_IN(tree(L, V, R), I) → U11(L, V, R, I, inorder_in(L, LI))
INORDER_IN(tree(L, V, R), I) → INORDER_IN(L, LI)
U11(L, V, R, I, inorder_out(L, LI)) → U21(L, V, R, I, LI, inorder_in(R, RI))
U11(L, V, R, I, inorder_out(L, LI)) → INORDER_IN(R, RI)
U21(L, V, R, I, LI, inorder_out(R, RI)) → U31(L, V, R, I, append_in(LI, .(V, RI), I))
U21(L, V, R, I, LI, inorder_out(R, RI)) → APPEND_IN(LI, .(V, RI), I)
APPEND_IN(.(X, Xs), Ys, .(X, Zs)) → U41(X, Xs, Ys, Zs, append_in(Xs, Ys, Zs))
APPEND_IN(.(X, Xs), Ys, .(X, Zs)) → APPEND_IN(Xs, Ys, Zs)

The TRS R consists of the following rules:

inorder_in(tree(L, V, R), I) → U1(L, V, R, I, inorder_in(L, LI))
inorder_in(nil, []) → inorder_out(nil, [])
U1(L, V, R, I, inorder_out(L, LI)) → U2(L, V, R, I, LI, inorder_in(R, RI))
U2(L, V, R, I, LI, inorder_out(R, RI)) → U3(L, V, R, I, append_in(LI, .(V, RI), I))
append_in(.(X, Xs), Ys, .(X, Zs)) → U4(X, Xs, Ys, Zs, append_in(Xs, Ys, Zs))
append_in([], X, X) → append_out([], X, X)
U4(X, Xs, Ys, Zs, append_out(Xs, Ys, Zs)) → append_out(.(X, Xs), Ys, .(X, Zs))
U3(L, V, R, I, append_out(LI, .(V, RI), I)) → inorder_out(tree(L, V, R), I)

The argument filtering Pi contains the following mapping:
inorder_in(x1, x2)  =  inorder_in(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U1(x1, x2, x3, x4, x5)  =  U1(x2, x3, x5)
nil  =  nil
[]  =  []
inorder_out(x1, x2)  =  inorder_out(x2)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x2, x5, x6)
U3(x1, x2, x3, x4, x5)  =  U3(x5)
append_in(x1, x2, x3)  =  append_in(x1, x2)
.(x1, x2)  =  .(x1, x2)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x5)
append_out(x1, x2, x3)  =  append_out(x3)
U41(x1, x2, x3, x4, x5)  =  U41(x1, x5)
APPEND_IN(x1, x2, x3)  =  APPEND_IN(x1, x2)
U31(x1, x2, x3, x4, x5)  =  U31(x5)
U21(x1, x2, x3, x4, x5, x6)  =  U21(x2, x5, x6)
U11(x1, x2, x3, x4, x5)  =  U11(x2, x3, x5)
INORDER_IN(x1, x2)  =  INORDER_IN(x1)

We have to consider all (P,R,Pi)-chains
The approximation of the Dependency Graph [30] contains 2 SCCs with 4 less nodes.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
PiDP
                ↳ UsableRulesProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

APPEND_IN(.(X, Xs), Ys, .(X, Zs)) → APPEND_IN(Xs, Ys, Zs)

The TRS R consists of the following rules:

inorder_in(tree(L, V, R), I) → U1(L, V, R, I, inorder_in(L, LI))
inorder_in(nil, []) → inorder_out(nil, [])
U1(L, V, R, I, inorder_out(L, LI)) → U2(L, V, R, I, LI, inorder_in(R, RI))
U2(L, V, R, I, LI, inorder_out(R, RI)) → U3(L, V, R, I, append_in(LI, .(V, RI), I))
append_in(.(X, Xs), Ys, .(X, Zs)) → U4(X, Xs, Ys, Zs, append_in(Xs, Ys, Zs))
append_in([], X, X) → append_out([], X, X)
U4(X, Xs, Ys, Zs, append_out(Xs, Ys, Zs)) → append_out(.(X, Xs), Ys, .(X, Zs))
U3(L, V, R, I, append_out(LI, .(V, RI), I)) → inorder_out(tree(L, V, R), I)

The argument filtering Pi contains the following mapping:
inorder_in(x1, x2)  =  inorder_in(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U1(x1, x2, x3, x4, x5)  =  U1(x2, x3, x5)
nil  =  nil
[]  =  []
inorder_out(x1, x2)  =  inorder_out(x2)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x2, x5, x6)
U3(x1, x2, x3, x4, x5)  =  U3(x5)
append_in(x1, x2, x3)  =  append_in(x1, x2)
.(x1, x2)  =  .(x1, x2)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x5)
append_out(x1, x2, x3)  =  append_out(x3)
APPEND_IN(x1, x2, x3)  =  APPEND_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
For (infinitary) constructor rewriting [30] we can delete all non-usable rules from R.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
PiDP
                    ↳ PiDPToQDPProof
              ↳ PiDP

Pi DP problem:
The TRS P consists of the following rules:

APPEND_IN(.(X, Xs), Ys, .(X, Zs)) → APPEND_IN(Xs, Ys, Zs)

R is empty.
The argument filtering Pi contains the following mapping:
.(x1, x2)  =  .(x1, x2)
APPEND_IN(x1, x2, x3)  =  APPEND_IN(x1, x2)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
                ↳ UsableRulesProof
                  ↳ PiDP
                    ↳ PiDPToQDPProof
QDP
                        ↳ QDPSizeChangeProof
              ↳ PiDP

Q DP problem:
The TRS P consists of the following rules:

APPEND_IN(.(X, Xs), Ys) → APPEND_IN(Xs, Ys)

R is empty.
Q is empty.
We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs:



↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
PiDP
                ↳ PiDPToQDPProof

Pi DP problem:
The TRS P consists of the following rules:

INORDER_IN(tree(L, V, R), I) → INORDER_IN(L, LI)
U11(L, V, R, I, inorder_out(L, LI)) → INORDER_IN(R, RI)
INORDER_IN(tree(L, V, R), I) → U11(L, V, R, I, inorder_in(L, LI))

The TRS R consists of the following rules:

inorder_in(tree(L, V, R), I) → U1(L, V, R, I, inorder_in(L, LI))
inorder_in(nil, []) → inorder_out(nil, [])
U1(L, V, R, I, inorder_out(L, LI)) → U2(L, V, R, I, LI, inorder_in(R, RI))
U2(L, V, R, I, LI, inorder_out(R, RI)) → U3(L, V, R, I, append_in(LI, .(V, RI), I))
append_in(.(X, Xs), Ys, .(X, Zs)) → U4(X, Xs, Ys, Zs, append_in(Xs, Ys, Zs))
append_in([], X, X) → append_out([], X, X)
U4(X, Xs, Ys, Zs, append_out(Xs, Ys, Zs)) → append_out(.(X, Xs), Ys, .(X, Zs))
U3(L, V, R, I, append_out(LI, .(V, RI), I)) → inorder_out(tree(L, V, R), I)

The argument filtering Pi contains the following mapping:
inorder_in(x1, x2)  =  inorder_in(x1)
tree(x1, x2, x3)  =  tree(x1, x2, x3)
U1(x1, x2, x3, x4, x5)  =  U1(x2, x3, x5)
nil  =  nil
[]  =  []
inorder_out(x1, x2)  =  inorder_out(x2)
U2(x1, x2, x3, x4, x5, x6)  =  U2(x2, x5, x6)
U3(x1, x2, x3, x4, x5)  =  U3(x5)
append_in(x1, x2, x3)  =  append_in(x1, x2)
.(x1, x2)  =  .(x1, x2)
U4(x1, x2, x3, x4, x5)  =  U4(x1, x5)
append_out(x1, x2, x3)  =  append_out(x3)
U11(x1, x2, x3, x4, x5)  =  U11(x2, x3, x5)
INORDER_IN(x1, x2)  =  INORDER_IN(x1)

We have to consider all (P,R,Pi)-chains
Transforming (infinitary) constructor rewriting Pi-DP problem [30] into ordinary QDP problem [15] by application of Pi.

↳ Prolog
  ↳ PrologToPiTRSProof
    ↳ PiTRS
      ↳ DependencyPairsProof
        ↳ PiDP
          ↳ DependencyGraphProof
            ↳ AND
              ↳ PiDP
              ↳ PiDP
                ↳ PiDPToQDPProof
QDP
                    ↳ QDPSizeChangeProof

Q DP problem:
The TRS P consists of the following rules:

U11(V, R, inorder_out(LI)) → INORDER_IN(R)
INORDER_IN(tree(L, V, R)) → U11(V, R, inorder_in(L))
INORDER_IN(tree(L, V, R)) → INORDER_IN(L)

The TRS R consists of the following rules:

inorder_in(tree(L, V, R)) → U1(V, R, inorder_in(L))
inorder_in(nil) → inorder_out([])
U1(V, R, inorder_out(LI)) → U2(V, LI, inorder_in(R))
U2(V, LI, inorder_out(RI)) → U3(append_in(LI, .(V, RI)))
append_in(.(X, Xs), Ys) → U4(X, append_in(Xs, Ys))
append_in([], X) → append_out(X)
U4(X, append_out(Zs)) → append_out(.(X, Zs))
U3(append_out(I)) → inorder_out(I)

The set Q consists of the following terms:

inorder_in(x0)
U1(x0, x1, x2)
U2(x0, x1, x2)
append_in(x0, x1)
U4(x0, x1)
U3(x0)

We have to consider all (P,Q,R)-chains.
By using the subterm criterion [20] together with the size-change analysis [32] we have proven that there are no infinite chains for this DP problem.

From the DPs we obtained the following set of size-change graphs: